package com.example.shopping.community.fragment;


import android.app.Dialog;
import android.content.Intent;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.ImageButton;
import android.widget.ImageView;

import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.ViewPager;

import com.example.shopping.R;
import com.example.shopping.app.DynamicActivity;
import com.example.shopping.base.BaseFragment;
import com.example.shopping.community.adapter.CommunityViewPagerAdapter;
import com.example.shopping.sell.adapter.ImagePickerAdapter;
import com.example.shopping.sell.util.GlideImageLoader;
import com.example.shopping.sell.util.SelectDialog;
import com.google.android.material.tabs.TabLayout;
import com.lzy.imagepicker.ImagePicker;
import com.lzy.imagepicker.bean.ImageItem;
import com.lzy.imagepicker.ui.ImageGridActivity;
import com.lzy.imagepicker.ui.ImagePreviewDelActivity;
import com.lzy.imagepicker.view.CropImageView;

import java.util.ArrayList;
import java.util.List;


public class CommunityFragment extends BaseFragment {
    private ImageButton ibCommunityIcon;
    private TabLayout tablayout;
    private ViewPager viewPager;
    private ImageButton ibCommunityMessage;
    private ImageView ib_add;
    private RecyclerView dynamic_add_rec;


    @Override
    public View initView() {
        View view = View.inflate(mContext, R.layout.fragment_community, null);

        ibCommunityIcon = view.findViewById(R.id.ib_community_icon);
        tablayout = view.findViewById(R.id.tablayout);
        viewPager = view.findViewById(R.id.view_pager);
        ib_add = view.findViewById(R.id.ib_add);

        CommunityViewPagerAdapter adapter = new CommunityViewPagerAdapter(getFragmentManager());

        viewPager.setAdapter(adapter);
        tablayout.setVisibility(View.VISIBLE);
        tablayout.setupWithViewPager(viewPager);


        initListener();

        return view;
    }

    @Override
    public void initData() {
        super.initData();
    }

    void initListener(){

        ib_add.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
               Intent intent = new Intent(mContext, DynamicActivity.class);
                startActivity(intent);
            }
        });


    }



}
